package tech.aistar.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import tech.aistar.exception.MyException;
import tech.aistar.model.pojo.Result;

/**
 * 本类用来演示: 全局异常处理器
 *
 * @author: success
 * @date: 2021/5/10 10:35 上午
 */
@RestController
public class ExceptionController {

    @GetMapping("/exception/error01")
    public Result hello(Integer id) throws MyException {
        if(id==100){
            throw new MyException("id不合法不合法!");
        }
        return new Result("200","ok");
    }

    @GetMapping("/exception/error02")
    public Result hell02(Integer id) throws MyException {
        System.out.println(10/0);
        return new Result("200","ok");
    }}
